<?php
declare(strict_types=1);
namespace App\One;
use App\Controller;
use Field\OneCampaignGroupConst;

// hook controller_one_search_campaign_group_use.php

/**
 * @title   计划组
 * @auth    true
 * @login   true
 * @menu    false
 * @component   vlist/index.vue
 * @icon    el-icon-menu
 * @active  true
 * @affix   false
 * @rank    99
 */
class CampaignGroup extends Controller
{
    // hook controller_one_search_campaign_group_public_start.php



    // hook controller_one_search_campaign_group_public_end.php

    /**
     * @title  下发配置
     * @rank    0
     */
    public function action_Conf_PUT()
    {
        // hook controller_one_search_campaign_group_conf_start.php
        $conf=['groupTotalRow'=>'bottom','grandTotalRow'=>'bottom','pageSize'=>10000,'remoteSort'=>0,'remoteFilter'=>0,'remoteSummary'=>0,'hidePagination'=>1,'hideRefresh'=>0,'hideDo'=>0,'add'=>0,'start'=>0,'stop'=>0,'delete'=>0,'import'=>0,'export'=>0,'pageSizes'=>[10,20,25,50,100,500,1000,10000],'TreeData'=>0,'Local'=>1,'enable'=>0,'disable'=>0,'chartRange'=>0,'copy'=>0];
        $Columns = [
            ['prop'=>'campaignGroupName','label'=>'计划组','hidden'=>0,'sortable'=>1,'aggFunc'=>'合计','pinned'=>'left'],
            ['prop'=>'campaignGroupId','label'=>'计划组ID','width'=>'80px','hidden'=>0,'sortable'=>1],
        ];
        array_push($Columns,...$this->public_columns) ;
        $Filter = [];
        $Tools = [];

        // hook controller_one_search_campaign_group_conf_end.php
        $this->response('0000', ['Conf' =>$conf, 'Filter' => $Filter, 'Tools' =>$Tools, 'Columns' => $Columns]);
    }
    /**
     * @title  下发修改计划组名配置
     * @rank    0
     */
    public function action_EditName_PUT()
    {
        $BizCode = $this->request->param('BizCode','');
        $data=[
                [
                    'span'=>12,
                    'title'=>"旧的名称",
                    'titleGetter' => '"旧的名称("+ form["old_title"]?.trim().split("\n").filter(Boolean).length+")"',
                    'formItems'=> [
                        [

                            'prop' => "old_title",
                            'span' => 24,
                            'rows' => 15,
                            'component' => 'input',
                            'valueGetter' => 'data.map(row => row["campaignGroupName"]).join("\r\n")',
                            'valueData' => 'data',
                            'readonly' => true,
                            'type' => 'textarea',
                        ]
                    ]
                ],
                [
                    'span'=>12,
                    'title'=>"新的名称",
                    'titleGetter' => '"新的名称("+ form["new_title"]?.trim().split("\n").filter(Boolean).length+")"',
                    'formItems'=>[
                            [
                                'prop' => "new_title",
                                'span' => 24,
                                'rows' => 15,
                                'component' => 'input',
                                'valueGetter' => 'data.map(row => row["campaignGroupName"]).join("\r\n")',
                                'valueData' => 'data',
                                'type' => 'textarea',
                            ]
                    ],
                ]
            ];
        $config=[
            'labelWidth'=>0,
            'labelPosition'=>'top',
        ];
        $this->response('0000', ['BizCode' =>$BizCode,'data'=>$data,'config'=>$config]);
    }
    /**
     * @title  下发修改计划组名配置
     * @rank    0
     */
    public function action_Create_PUT()
    {
        $BizCode = $this->request->param('BizCode','');
        $data=[
                [
                    'span'=>24,
                    'title'=>"新的计划组名称",
                    'titleGetter' => '"新的计划组名称("+ form["campaignGroupName"]?.trim().split("\n").filter(Boolean).length+")"',
                    'formItems'=>[
                        [
                            'prop' => "campaignGroupName",
                            'span' => 24,
                            'rows' => 15,
                            'component' => 'input',
                            'type' => 'textarea',
                        ]
                    ],
                ]
            ];
        $config=[
            'labelWidth'=>0,
            'labelPosition'=>'top',
        ];
        $this->response('0000', ['BizCode' =>$BizCode,'data'=>$data,'config'=>$config]);
    }


    // hook controller_one_search_campaign_group_end.php
}

?>